package codingforgreat.lchot150;

public class Lc121 {
    public int maxProfit(int[] prices) {
        int res = 0;
        int min = prices[0];
        for(int i = 1;i < prices.length;i++){
            res = Math.max(prices[i] - min,res);
            min = Math.min(prices[i],min);
        }
        return res;

    }
}
